import myAxios from "../plugins/myAxios";
// 获取当前用户信息
export const getCurrentUser = async () => {
    const res = await myAxios.get("/user/current").then((res) => {
        if (res.data.code == 1) {
            console.log("获取用户信息成功");
            return res.data.data;
        } else {
            console.log("获取用户信息失败：" + res.data.msg);
            return null;
        }
    });
    return res;
};
// 用户退出登录
export const exit = (router) => {
    var r = confirm("确定要退出登录吗，QAQ");
    if (r == true) {
        myAxios.post("/user/logout").then((res) => {
            if (res.data.code == 1) {
                console.log("退出登录成功");
                router.replace({
                    path: "/login",
                });
            } else {
                console.log("退出登录失败：" + res.data.msg);
            }
        });
    }
}
